SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROC [dbo].[usp_Booking_DuKhach]
	@SO_BOOKING	CHAR(15),
	@HO_TEN_DK	NVARCHAR(50),
	@NGAY_SINH	DATE,
	@DIA_CHI_DK	NVARCHAR(100),
	@GIOI_TINH	CHAR(3),
	@TRANG_THAI_PHONG_DON	CHAR(5),
	@DO_TUOI	CHAR(10),
	@LOAI_KHACH	CHAR(10)
	
AS
BEGIN
	IF @NGAY_SINH = '1/1/1800'
	BEGIN
		SET @NGAY_SINH = NULL
	END
	
	IF @DIA_CHI_DK = 'NULL'
	BEGIN
		SET @DIA_CHI_DK = NULL
	END  

	INSERT INTO DU_KHACH  VALUES
	(@SO_BOOKING, @HO_TEN_DK, @NGAY_SINH, @DIA_CHI_DK, @GIOI_TINH, @TRANG_THAI_PHONG_DON, @LOAI_KHACH, @DO_TUOI)	
END 

GO
